<template>
  <div class="mode-toggle">
    <button 
      type="button"
      :class="['toggle-btn', { active: isLoginMode }]"
      @click="emit('switchToLogin')"
    >
      登录
    </button>
    <button 
      type="button"
      :class="['toggle-btn', { active: !isLoginMode }]"
      @click="emit('switchToRegister')"
    >
      注册
    </button>
  </div>
</template>

<script setup lang="ts">
interface Props {
  isLoginMode: boolean
}

interface Emits {
  (e: 'switchToLogin'): void
  (e: 'switchToRegister'): void
}

defineProps<Props>()
const emit = defineEmits<Emits>()
</script>

<style scoped>
/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 32px;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: white;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-btn:hover:not(.active) {
  color: #1e293b;
}

/* Responsive Design */
@media (max-width: 640px) {
  .toggle-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}
</style>
